﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing.plaf.basic.icon {
    import flash.display.*;
    import flash.geom.*;
    import org.aswing.*;
    import org.aswing.plaf.*;
    import org.aswing.graphics.*;

    public class SliderThumbIcon implements Icon, UIResource {

        protected var thumb:Sprite;
        protected var enabledButton:SimpleButton;
        protected var disabledButton:SimpleButton;
        protected var overButton:SimpleButton;

        public function SliderThumbIcon(){
            this.thumb = new Sprite();
        }
        protected function getPropertyPrefix():String{
            return ("Slider.");
        }
        protected function initThumb(_arg1:Component):void{
            this.enabledButton = new SimpleButton();
            var _local2:Shape = new Shape();
            var _local3:Graphics2D = new Graphics2D(_local2.graphics);
            this.paintThumb(_local3, _arg1, true, false);
            var _local4:Shape = new Shape();
            _local3 = new Graphics2D(_local4.graphics);
            this.paintThumb(_local3, _arg1, true, true);
            this.enabledButton.upState = _local2;
            this.enabledButton.overState = _local4;
            this.enabledButton.downState = _local4;
            this.enabledButton.hitTestState = _local2;
            this.enabledButton.useHandCursor = false;
            this.thumb.addChild(this.enabledButton);
            this.disabledButton = new SimpleButton();
            _local2 = new Shape();
            _local3 = new Graphics2D(_local2.graphics);
            this.paintThumb(_local3, _arg1, false, false);
            this.disabledButton.upState = _local2;
            this.disabledButton.overState = _local2;
            this.disabledButton.downState = _local2;
            this.disabledButton.hitTestState = _local2;
            this.disabledButton.useHandCursor = false;
            this.thumb.addChild(this.disabledButton);
            this.disabledButton.visible = false;
        }
        private function paintThumb(_arg1:Graphics2D, _arg2:Component, _arg3:Boolean, _arg4:Boolean):void{
            var _local5:StyleTune = _arg2.getStyleTune().mide;
            var _local6:ASColor = _arg2.getMideground();
            if (!_arg3){
                _local6 = _local6.offsetHLS(0, -0.1, -0.1);
                _local5 = _local5.sharpen(0.2);
            } else {
                if (_arg4){
                    _local6 = _local6.offsetHLS(-0.2, 0, 0);
                };
            };
            var _local7:StyleResult = new StyleResult(_local6, _local5);
            var _local8:int = this.getIconWidth(null);
            var _local9:int = this.getIconHeight(null);
            var _local10:Matrix = new Matrix();
            _local10.createGradientBox(_local8, _local9, (Math.PI / 2), 0, 0);
            var _local11:GradientBrush = new GradientBrush(GradientBrush.LINEAR, [_local7.blight.getRGB(), _local7.bdark.getRGB()], [_local7.blight.getAlpha(), _local7.bdark.getAlpha()], [0, 0xFF], _local10);
            _arg1.fillEllipse(_local11, 0, 0, _local8, _local9);
            _local10.createGradientBox(_local8, _local9, (-(Math.PI) / 2), 0, 0);
            _local11.setColors([_local7.clight.getRGB(), _local7.cdark.getRGB()]);
            _local11.setAlphas([_local7.clight.getAlpha(), _local7.cdark.getAlpha()]);
            _arg1.fillEllipse(_local11, 1, 1, (_local8 - 2), (_local9 - 2));
        }
        public function updateIcon(_arg1:Component, _arg2:Graphics2D, _arg3:int, _arg4:int):void{
            if (this.enabledButton == null){
                this.initThumb(_arg1);
            };
            this.thumb.x = _arg3;
            this.thumb.y = _arg4;
            this.disabledButton.visible = !(_arg1.isEnabled());
            this.enabledButton.visible = _arg1.isEnabled();
        }
        public function getIconHeight(_arg1:Component):int{
            return (14);
        }
        public function getIconWidth(_arg1:Component):int{
            return (14);
        }
        public function getDisplay(_arg1:Component):DisplayObject{
            return (this.thumb);
        }

    }
}//package org.aswing.plaf.basic.icon 
